/*
 * @Descripttion: 
 * @Author: wayde
 * @Date: 2021-10-30 09:54:53
 */
const http = require('http')
const url = require('url')
const path = require('path')
const readStaticFile = require("./modules/readStaticFile")

var server = http.createServer((req,res)=>{
    const urlobj = url.parse(req.url)// 获取url对象
    const urlPathName = urlobj.pathname // 获取路径
    const filePathName = path.join(__dirname,"/public",urlPathName)
    // 读取服务器文件
    readStaticFile(req,res,filePathName)
})

server.listen(3300,()=>{
    console.log('server is starting ....');
    console.log('listening 3000 port');
})